layui.define([ 'form', 'laydate', 'table' ], function(exports) {
	var form = layui.form;
	var loginForm = $("#indexLoginForm");
	var view = {
		init : function() {
			this.initLogin();
			this.initLogout();
		},
		initLogin : function() {
			$(document).on("submit","#indexLoginForm",function() {
				var self = this;
				Lib.submitForm("/member/login.json",$(this),{},function(data) {
					$(self).closest(".index-login").load("/ajax/loginStatus.do");
				})
				return false;
			})
		},
		initLogout: function() {
			$(document).on("click", "#logoutBtn" ,function() {
				var self = this;
				Common.post("/member/logout.json", {}, function() {
					//document.location.href="/";
					//return;
					$(self).closest(".index-login").load("/ajax/loginStatus.do",function() {
						//layui.use(['loginAndLogout'], function(){
						   // var loginAndLogout = layui.loginAndLogout;
						    //loginAndLogout.init();
						//});
					});
				});
			})
		}
	}
	exports('loginAndLogout', view);
});

